<?php

class SJB_Menu_TopMenu extends SJB_Function
{
	public function execute()
	{
		$today = date('Y-m-d H:i:s');
		$check = SJB_DB::query(" select count(*) as count from listings where listing_type_sid='6' 
			and activation_date like '%".date('Y-m-d')."%' ");
		if($check[0]['count']==0){
			$results = SJB_DB::query(" select * from listings where listing_type_sid='6' ");		
			for($i=0;$i<10;$i++)
			{
				$rand = rand(1,count($results));
				$sid = $results[$rand]['sid'];
				SJB_DB::query("update listings set activation_date='$today', active='1' where sid='$sid' ");
			}
		}
		
		$tp = SJB_System::getTemplateProcessor();
		$tp->display('top.tpl');
	}
}

